package com.sunc.demo.item.service;

import com.sunc.demo.item.entity.Item;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class ItemService {

    private final static Map<Long,Item> MAP = new HashMap<>();

    static {
        MAP.put(1L,new Item(1L,"商品1","http://图片1","商品描述1",1000L));
        MAP.put(2L,new Item(2L,"商品2","http://图片2","商品描述2",2000L));
        MAP.put(3L,new Item(3L,"商品3","http://图片3","商品描述3",3000L));
        MAP.put(4L,new Item(4L,"商品4","http://图片4","商品描述4",4000L));
        MAP.put(5L,new Item(5L,"商品5","http://图片5","商品描述5",5000L));
    }


    public Item queryItemById(Long id){
        return MAP.get(id);
    }

}
